package com.allen.app.common.utils;

import cn.hutool.extra.spring.SpringUtil;
import lombok.experimental.UtilityClass;
import org.redisson.api.RedissonClient;
import org.springframework.data.redis.core.ValueOperations;

/**
 * Spring对象池
 */
@SuppressWarnings("unchecked")
@UtilityClass
public class SpringObjPool {


    public ValueOperations<String, Object> getValueOperations() {
        return Try.tryCatch(()->SpringUtil.getBean(ValueOperations.class),null);
    }

    public RedissonClient getRedissonClient() {
        return Try.tryCatch(()->SpringUtil.getBean(RedissonClient.class),null);
    }

}
